package cn.luischen.controller.admin;

import cn.luischen.service.log.LogService;
import cn.luischen.service.option.OptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import cn.luischen.controller.BaseController;
import org.springframework.stereotype.Controller;
import io.swagger.annotations.ApiOperation;
import javax.servlet.http.HttpServletRequest;
import cn.luischen.utils.APIResponse;
import org.springframework.web.bind.annotation.GetMapping;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.luischen.utils.GsonUtils;
import cn.luischen.constant.LogActions;
import cn.luischen.model.OptionsDomain;
import cn.luischen.constant.WebConst;

import org.powermock.reflect.Whitebox;
import org.mockito.Mock;
import static org.junit.Assert.fail;
import org.junit.runner.RunWith;
import java.util.HashMap;
import java.util.ArrayList;
import org.mockito.MockitoAnnotations;
import com.alibaba.fastjson.JSONArray;
import java.util.Map;
import org.junit.After;
import org.powermock.core.classloader.annotations.PrepareForTest;
import static org.junit.Assert.assertEquals;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import java.lang.reflect.Method;
import org.junit.rules.ExpectedException;
import org.mockito.InjectMocks;
import org.junit.Test;
import static org.junit.Assert.*;
import com.unitspirit.runtime.*;
import org.mockito.Mockito;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import org.junit.Rule;
import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import static org.junit.Assert.assertTrue;
import com.alibaba.fastjson.parser.ParserConfig;

/**
* The class <code>SettingControllerTest</code> contains tests for the class <code>{@link SettingController}</code>.
* Copyright (c) 2020
* 
* @generatedBy UnitSpirit at 2021-09-07 17:51:40
* @version 1.0.20210903
*/

@PowerMockIgnore({ "javax.management.*" })
@RunWith(PowerMockRunner.class)
@PrepareForTest({ cn.luischen.service.option.impl.OptionServiceImpl.class })
public class SettingController_setting_WGTest {

	@InjectMocks
	cn.luischen.controller.admin.SettingController unitspirit_fixture;
	@Mock
	cn.luischen.service.option.OptionService mock_OptionService;
	@Mock
	cn.luischen.service.log.LogService mock_LogService;

	@Rule
	public ExpectedException unitspirit_thrown = ExpectedException.none();

	/**
	* 测试方法初始化.
	* 
	* @throws Exception 
	*         if the initialization fails for some reason 
	*  
	* @generatedBy UnitSpirit at 2021-09-07 17:51:40
	*/
	@org.junit.Before
	public void setUp() throws Exception {
		try {
			GlobalUnitInit.init();
			MockitoAnnotations.initMocks(this);
			ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

	/**
	* @date 2021-09-07 17:51:41
	* @see cn.luischen.controller.admin.SettingController#setting
	* @category auto generate by UnitSpirit  
	* @author UnitSpirit   
	*/
	@Test
	public void test_setting_20210722_100107_175_2_01() throws Throwable {
		//被测函数参数定义
		javax.servlet.http.HttpServletRequest HttpServletRequest_p_0 = Mockito
				.mock(javax.servlet.http.HttpServletRequest.class);
		//成员变量设置

		//返回值定义 
		String result_expected = "admin/setting";

		java.util.List<cn.luischen.model.OptionsDomain> mock_result_ArrayList14 = JSON.parseArray(
				"[{\"name\":\"baidu_site_verification\",\"description\":\"百度网站验证码\",\"value\":\"123\"},{\"name\":\"google_site_verification\",\"description\":\"google网站验证码\",\"value\":\"111\"},{\"name\":\"site_description\",\"description\":\"网站描述\",\"value\":\"erer\"},{\"name\":\"site_keywords\"},{\"name\":\"site_record\",\"description\":\"备案号\",\"value\":\"222\"},{\"name\":\"site_title\",\"description\":\"网站标题\",\"value\":\"11122211\"},{\"name\":\"social_csdn\",\"description\":\"csdn\",\"value\":\"111\"},{\"name\":\"social_github\",\"description\":\"github\",\"value\":\"\"},{\"name\":\"social_jianshu\",\"description\":\"简书地址\",\"value\":\"123\"},{\"name\":\"social_resume\",\"description\":\"简历地址\",\"value\":\"\"},{\"name\":\"social_twitter\",\"description\":\"twitter\",\"value\":\"\"},{\"name\":\"social_weibo\",\"description\":\"微博地址\",\"value\":\"333\"},{\"name\":\"social_zhihu\",\"description\":\"知乎地址\",\"value\":\"\"}]",
				cn.luischen.model.OptionsDomain.class);

		PowerMockito.when(mock_OptionService.getOptions()).thenReturn(mock_result_ArrayList14);

		String unitspirit_result = unitspirit_fixture.setting(HttpServletRequest_p_0);
		//getAssertCase 
		UnitAssert.assertEquals(result_expected, unitspirit_result);
	}
}
